package com.leyou.goods.search.pojo;



import java.util.Map;



public class SearchRequest {

    private  String key;

    private Integer page;// 褰撳墠椤?


    private Map<String,String> filter;



    public Map<String, String> getFilter() {

        return filter;

    }



    public void setFilter(Map<String, String> filter) {

        this.filter = filter;

    }



    private static final Integer DEFAULT_SIZE = 20;// 姣忛〉澶у皬锛屼笉浠庨〉闈㈡帴鏀讹紝鑰屾槸鍥哄畾澶у皬

    private static final Integer DEFAULT_PAGE = 1;// 榛樿椤?
    public String getKey() {

        return key;

    }



    public void setKey(String key) {

        this.key = key;

    }



    public Integer getPage() {

        if(page == null){

            return DEFAULT_PAGE;

        }

        // 鑾峰彇椤电爜鏃跺仛涓€浜涙牎楠岋紝涓嶈兘灏忎簬1

        return Math.max(DEFAULT_PAGE, page);

    }



    public void setPage(Integer page) {

        this.page = page;

    }



    public Integer getSize() {

        return DEFAULT_SIZE;

    }



    @Override

    public String toString() {

        return "SearchRequest{" +

                "key='" + key + '\'' +

                ", page=" + page +

                '}';

    }

}
